﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="Header.ascx.cs" Inherits="NCS.Module.CMS.Web.HomePage.Header" %>
<%@ Register Assembly="NCS.Module.MultiLanguage" Namespace="NCS.Module.MultiLanguage.WebControls"
    TagPrefix="cc1" %>
<%@ Register Assembly="NCS.Module.Adsvertising" Namespace="NCS.Module.Adsvertising.Advertise"
    TagPrefix="cc1" %>
<!-- begin add phongla 2012_08_07 
    chuyển search lên header -->
<%@ Register Src="Search.ascx" TagName="Search" TagPrefix="uc17" %>
<!-- end add phongla 2012_08_07 -->
<% if(NCS.Library.AppEnv.GetLanguage() == "vi-VN") { %>
<div class="logo_vi"></div>
<%} else { %>
<div class="logo_en"></div>
<%} %>
<!--begin menu top-->
<div class="menutop">
    <ul id="nav">
    <li>
        <a class='home' href='/'>
            <img border="0" src="/Images/HomePage/NewStyle/bt_tc.gif" width="42" height="28" />
        </a>
    </li>
	<% = this.topmenu %>	
	<li style="width:183px;float:right;">
        <!-- begin add phongla 2012_08_07 
            chuyển search lên header -->	    
	    <uc17:Search ID="Search1" runat="server" />
	    <!-- end add phongla 2012_08_07 -->
	</li>
	</ul>
    <div style="clear:both"></div>
</div>
<!--end menu top-->
<!--begin menu sub-->
<div id="submenu" class="menu_sub">
<ul id="subnav">
<asp:Repeater ID="rpt_foot" runat="server">
    <ItemTemplate>
        <li rel="lv0" class="lv0">
            <asp:HyperLink CssClass="submenu_lv0" ID="hplk" runat="server"></asp:HyperLink>
        </li>
    </ItemTemplate>
</asp:Repeater>
<%
    if (this.Request.IsAuthenticated)
    { 
        %>
        <li rel="lv0" class="lv0" style="float:right;">
            <a class="submenu_lv0" style="font-weight:bold;" href="#">Xin chào: <% = this.CurrentUser.Username %></a>
            <ul>
            <asp:Repeater runat="server" ID="rpt_menuAdmin" OnItemDataBound="rpt_menuAdmin_ItemDataBound">
                <ItemTemplate>
                    <li rel="lv1">
                        <asp:HyperLink CssClass="submenu_lv1" ID="link_menu" runat="server"></asp:HyperLink>
                    </li>
                </ItemTemplate>
            </asp:Repeater>
                <li>
                    <asp:LinkButton CssClass="submenu_lv1" runat="server" ID="link_logout" OnClick="lik_logout_Click">Đăng xuất</asp:LinkButton>
                </li>
            </ul>
        </li>
        <%
    }
%>
</ul>
</div>
<!--end menu sub-->

<script type="text/javascript">

 $(document).ready(function(){					
	
	//#nav
	$(" #nav ul ").css({display: "none"}); // Opera Fix
    $(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
	
	//#subnav
	/*$(" #subnav ul ").css({display: "none"}); // Opera Fix
    $(" #subnav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});*/
	
	
	$(" #subnav ul ").css({ display: "none" }); // Opera Fix

    $(" #subnav li").hover(
        function() {
            if ($(this).attr('rel') == 'lv0') {

                left = $(this).offset().left + 200;
                left = left - $('#submenu').offset().left;

                if ($('#submenu').width() - left < 0)
                    left = (200 - $(this).width()) * -1;

            } else {
                var left = $(this).offsetParent().offset().left + 400;
                left = left - $('#submenu').offset().left;

                if ($('#submenu').width() - left < 30)
                    left = -200;
            }

            if (left < 0) {
                $(this).find('ul:first').css({ visibility: "visible", display: "none", left: left + 'px' }).show(400);
            } else {
                $(this).find('ul:first').css({ visibility: "visible", display: "none" }).show(400);
            }
        }, function() {
            $(this).find('ul:first').css({ visibility: "hidden" });
        }
    );
    
});

</script>